import { Component } from 'vue-facing-decorator'
import Render from '@/render/Render'
import toNative from '@/utils/toNative'
import TableRender, { type TableRenderColumnTypes } from '@/render/TableRender'
import { Button } from 'ant-design-vue'
import CustomerDetailView from './detail/Index'
import type { PageDto } from '@/api/types'
import type { AnyObject } from '@/types'
import { getAgentCustomerCompanyList } from '@/api/insurance/agent'
import type { InsureAgentCompanyDto } from '@/api/insurance/agent/types'
@Component
export class AgentCustomerView extends TableRender {
    filterConfig() { 
        return {
            companyId: {
                name: '保险产品',
                element: 'select',
                placeholder: '请输入后选择',
                optionsType: 'company'
            },
            customerId: {
                name: '客户名称',
                element: 'select',
                placeholder: '请输入后选择',
                optionsType: 'company'
            },
            dataSources : {
                name: '数据来源',
                element: 'select',
                placeholder: '请输入后选择',
                optionsType: 'company'
            },
        }
    }
	

    tableColumnConfig(){
        return [
            {
                field: 'companyName',
                title: '客户名称',
                slots: {
                    default: 'toNext'
                },
                params: {
                    path:(row) => {
                        return `/customer/${row.companyId}`
                    },
                },
            },
            {
                field: 'labourCompanyId',
                title: '代理商客户产品ID',
            },
            {
                field: 'id',
                title: '保险产品',
            },
            {
                field: 'id',
                title: '状态',
            },
            {
                field: 'agentName',
                title: '数据来源',
            },
            {
                field: 'id',
                title: '累积保费',
            },
            {
                field: 'id',
                title: '理赔率',
            },
            {
                field: 'caseCount',
                title: '在保人次',
            },
            {
                field: 'createTime',
                title: '建档时间',
            }
        ] as TableRenderColumnTypes<InsureAgentCompanyDto>
    }

    onLoadData(pageNum: number, pageSize: number, filters: AnyObject) {
        return getAgentCustomerCompanyList({
            pageNum,
            pageSize,
            ...filters
        })
    }

    renderTitle() { 
        return (
            <div class="flex items-center justify-between px-24 py-20">
                <div class="text-black-light-200 text-lg font-semibold">筛选</div>
                <Button type="primary">导出账单</Button>
            </div>
        )
    }
	
}

export default toNative<{}, {}>(AgentCustomerView)